package org.example.iris.controller;

import org.example.iris.service.InternshipEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/evaluation")
public class InternshipEvaluationController {

    @Autowired
    private InternshipEvaluationService evaluationService;

    // 提交实习评价
    @PostMapping("/submit")
    public String submitEvaluation(@RequestParam int studentId,
                                   @RequestParam int companyId,
                                   @RequestParam int evaluationScore,
                                   @RequestParam String comments) {
        try {
            evaluationService.submitEvaluation(studentId, companyId, evaluationScore, comments);
            return "评价提交成功";
        } catch (Exception e) {
            return "评价提交失败：" + e.getMessage();
        }
    }

    // 获取评价记录
    @GetMapping("/get")
    public Map<String, Object> getEvaluation(@RequestParam int studentId,
                                             @RequestParam int companyId) {
        return evaluationService.getEvaluation(studentId, companyId);
    }
}
